var log = function(msg) {
	console.log(msg)
};

var jsonpcallback2 = function(rst, arg2, arg3) {
	var msg = "";
	try {
		if (!rst) {
			msg = "return null";
		} else if (rst.success == false) {
			msg += rst.resultMessage;
		} else if (rst.success === true) {
			var snapshots = rst.snapshots;
			for ( var i = 0; i != snapshots.length; i++) {
				var snapshot = snapshots[i];
				msg += "threadPoolName:" + snapshot.threadPoolName;
				msg += ", threadPriority:" + snapshot.threadPriority;
				msg += ", activeCount:" + snapshot.activeCount;
				msg += ", corePoolSize:" + snapshot.corePoolSize;
				msg += ", keepAliveSeconds:" + snapshot.keepAliveSeconds;
				msg += ", maxPoolSize:" + snapshot.maxPoolSize;
				msg += ", poolSize:" + snapshot.poolSize;
				msg += "<br/>";
			}
		}
	} catch (e) {
		msg += e;
	}
	$("<p>" + msg + "</p>").appendTo("#log");
}

var testAjax = function() {
	// var url =
	// "http://localhost:8080/springcool-demo/services/rest/getRestResponse?callbackjsonp=?";
	var url = "http://localhost:8084/csa-web/services/TaskExecutorRestService/getThreadPoolSnapshot?jsonpcallback=?";
//	try {
//		$.getJSON(url).complete(function(rst) {
//			$("<p>complete</p>").appendTo("#log");
//		});
//	} catch (e) {
//		alert("catch:" + e);
//	}
	var data = {};
	var name = 'main';

	if (!data[name]) {
		data[name] = {};
		data[name]['maxSize'] = RGraph.array_pad([], 500, 10);
		data[name]['curSize'] = RGraph.array_pad([], 500, 5);
		data[name]['activeCount'] = RGraph.array_pad([], 500, 1);
	}
	var main = data['main'];


}

var Test = function(idin) {
	this.id = idin;
	log("test:" + this.id + ", ret:" + this);
	/*
	 * init = function () { ret = new Test.fn.init2(); log("init:" + id + ",
	 * ret:" + ret); return ret; }
	 */
};

Test.prototype = {
	init : function() {
		log("init:" + this.id + ", ret:" + this);
		this.doSth();
	},

	doSth : function() {
		log("doSth:" + this.id);
	}
}

function testPrototype() {
	// alert("log:" + log);
	// alert("Test.init:" + Test.init);
	// alert("Test().init:" + Test().init);
	var t = new Test("t");
	// alert("t.init:" + t.init);
	try {
		t.init();
		new Test("t2").init();
		t.init();
	} catch (e) {
		alert(e)
	}
	// try{ Test("t2").init() } catch(e) { alert(e) }
	// try{ t.init() } catch(e) { alert(e) }
}
// testInit();
